package com.zyg.dao;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.zyg.pojo.Grade;
import com.zyg.pojo.Class;
import org.apache.ibatis.annotations.*;

import java.util.List;

public interface ClassMapper extends BaseMapper<Class> {
    @Override
    @Select("select class_id, class_name, grade_id from sys_class ${ew.customSqlSegment}")
    @Results({
            @Result(column = "class_id", property = "classId"),
            @Result(column = "class_name", property = "className"),
            @Result(column = "grade_id", property = "grade", javaType = Grade.class,
                    one = @One(select = "com.zyg.dao.GradeMapper.getGradeById"))
    })
    List<Class> selectList(IPage<Class> page, @Param(Constants.WRAPPER) Wrapper<Class> queryWrapper);
}